package com.gyh.system.scheduler.test;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.gyh.system.scheduler.entity.ScheduleJobLog;
import com.gyh.system.scheduler.service.ScheduleJobLogService;

/**
* @author 作者 gyh:
* @version 创建时间：2018年1月6日 上午12:37:43
* 
*/

public class AppTest2 {
	
	public static void main(String[] args) {
		ApplicationContext ac = new ClassPathXmlApplicationContext("classpath:spring/spring-context.xml");
		ScheduleJobLogService service = ac.getBean(ScheduleJobLogService.class);
		
		ScheduleJobLog log = new ScheduleJobLog();
		log.setId(1L);
		log.setJobId(1L);
		log.setBeanName("修改1");
		log.setMethodName("method1");
		log.setParams("params1");
		log.setCreateTime(new Date());
		log.setStatus(1);
		log.setTimes(new Date().getTime());
		log.setError("rwghegjfkdsnlkgjsdhfogkjdslkshglkj");
		log.setCreateTime(new Date());
		ScheduleJobLog log2 = new ScheduleJobLog();
		log2.setId(2L);
		log2.setJobId(1L);
		log2.setBeanName("修改2");
		log2.setMethodName("method2");
		log2.setParams("params2");
		log2.setCreateTime(new Date());
		log2.setStatus(1);
		log2.setTimes(new Date().getTime());
		log2.setError("rwghegjfkdsnlkgjsdhfogkjdslkshglkj");
		log2.setCreateTime(new Date());
		ScheduleJobLog log3 = new ScheduleJobLog();
		log3.setJobId(1L);
		log3.setBeanName("修改2");
		log3.setMethodName("method2");
		log3.setParams("params2");
		log3.setCreateTime(new Date());
		log3.setStatus(1);
		log3.setTimes(new Date().getTime());
		log3.setError("rwghegjfkdsnlkgjsdhfogkjdslkshglkj");
		log3.setCreateTime(new Date());
		
		List<ScheduleJobLog> list = new ArrayList<>();
		list.add(log3);
		list.add(log2);
		list.add(log);
		//int num = service.insertList(list);
		//int num = service.insert(log2);
		int num = service.update(log2);
		//int num = service.updateList(list);
		//int num = service.saveList(list);
		System.out.println(num);
	}
}
